﻿// http://blogs.dotnet-france.com/leonardl/post/RIA-Services-Un-mock-pour-faciliter-la-testabilite.aspx
namespace RialternativeSample.Tests.Client
{
    using System;
    using System.Collections.Generic;
    using System.ServiceModel.DomainServices.Client;
    using System.Threading;

    /// <summary>
    /// Represents an asynchronous result from a DomainClient.
    /// </summary>
    public class MockDomainClientAsyncResult : IAsyncResult
    {
        /// <summary>
        /// Gets or sets the entities.
        /// </summary>
        /// <value>The entities.</value>
        public IEnumerable<Entity> Entities { get; set; }

        /// <summary>
        /// Gets or sets a user-defined object that qualifies or contains information about an asynchronous operation.
        /// </summary>
        /// <value>The Async state.</value>
        /// <returns>A user-defined object that qualifies or contains information about an asynchronous operation.</returns>
        public object AsyncState { get; set; }

        /// <summary>
        /// Gets a <see cref="T:System.Threading.WaitHandle"/> that is used to wait for an asynchronous operation to complete.
        /// </summary>
        /// <value>The Async wait handle.</value>
        /// <returns>A wait handle that is used to wait for an asynchronous operation to complete.</returns>
        public WaitHandle AsyncWaitHandle
        {
            get
            {
                return null;
            }
        }

        /// <summary>
        /// Gets a value indicating whether the asynchronous operation completed synchronously.
        /// </summary>
        /// <value>The completion async state of the result.</value>
        /// <returns>true if the asynchronous operation completed synchronously; otherwise, false.</returns>
        public bool CompletedSynchronously
        {
            get { return false; }
        }

        /// <summary>
        /// Gets or sets a value indicating whether the asynchronous operation has completed.
        /// </summary>
        /// <value>The completion state of the result.</value>
        /// <returns>true if the operation is complete; otherwise, false.</returns>
        public bool IsCompleted { get; set; }
    }
}
